<?php
namespace voxfa\command;

require_once dirname(__FILE__)."/commandManager.php";

/**
 * 命令请求
 * @author sonic
 * @date  2010-1-31  下午07:47:16
 */
class Command {
	
	protected $commandProcessor;
	protected $command = array();
	protected $datamap = array();
	
	public function __construct($commandProcessor){
		$this->commandProcessor = $commandProcessor;
	}
	
	public function inCommandQueue($command){
		$this->command[]=$command;
	}
	
	public function existCommand($command){
		return in_array($command,$this->command);
	}
	
	public function outCommandQueue(){
		return array_shift($this->command);	
	}
	
	/**
	 * @return the $commandProcessor
	 */
	public function getCommandProcessor() {
		return $this->commandProcessor;
	}

	/**
	 * @return the $Command
	 */
	public function getCommand() {
		return $this->command;
	}

	/**
	 * @return the $datamap
	 */
	public function getDatamap() {
		return $this->datamap;
	}

	/**
	 * @param $commandProcessor the $commandProcessor to set
	 */
	public function setCommandProcessor($commandProcessor) {
		$this->commandProcessor = $commandProcessor;
	}

	/**
	 * @param $Command the $Command to set
	 */
	public function setCommand($command) {
		$this->command = $command;
	}

	/**
	 * @param $datamap the $datamap to set
	 */
	public function setDatamap($datamap) {
		$this->datamap = $datamap;
	}
	
	public function run(){
		commandManager::getInstance()->run($this);
	}
}